home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac-Source 1994 July
/
Mac-Source_July_1994.iso
/
Other Langs
/
Tickle-4.0 (tcl)
/
src
/
PROC_AEVTtcl1eval.c
< prev
next >
Wrap
Text File
|
1993-11-18
|
2KB
|
89 lines
/*
** This source code was written by Tim Endres
** Email: time@ice.com.
** USMail: 8840 Main Street, Whitmore Lake, MI 48189
**
** Some portions of this application utilize sources
** that are copyrighted by ICE Engineering, Inc., and
** ICE Engineering retains all rights to those sources.
**
** Neither ICE Engineering, Inc., nor Tim Endres,
** warrants this source code for any reason, and neither
** party assumes any responsbility for the use of these
** sources, libraries, or applications. The user of these
** sources and binaries assumes all responsbilities for
** any resulting consequences.
*/
#include <Types.h>
#include <Resources.h>
#include <QuickDraw.h>
#include <Windows.h>
#include <Memory.h>
#include <AppleEvents.h>
#include <Aliases.h>
#include "tcl.h"
#include "xproc.h"
pascal OSErr
PROCEntry(message, reply, refcon)
AppleEvent *message;
AppleEvent *reply;
long refcon;
{
int myerr, result = noErr;
long length;
AEDesc theDesc;
Handle rHandle;
XPROCPBPtr cbpb;
cbpb = (XPROCPBPtr) refcon;
dprintf("AEVT: class 'tcl1' event 'eval' ");
myerr = AEGetParamDesc(message, keyDirectObject, typeChar, &theDesc);
if (myerr != noErr) {
result = myerr;
dprintf("GetParamDesc error %d in AEVT-source", myerr);
}
else
{
length = GetHandleSize(theDesc.dataHandle);
SetHandleSize(theDesc.dataHandle, length + 1);
if (MemError() == noErr)
{
* (*theDesc.dataHandle + length) = '\0';
rHandle = NewHandle(0);
if (rHandle != NULL) {
result = (* cbpb->eval)(cbpb, theDesc.dataHandle, rHandle, NULL);
length = GetHandleSize(rHandle);
if (result == TCL_OK)
{
HLock(rHandle);
myerr = AEPutParamPtr(reply, keyDirectObject, typeChar,
*rHandle, length);
HUnlock(rHandle);
}
else if (length > 0)
{
HLock(rHandle);
myerr = AEPutParamPtr(reply, keyErrorString, typeChar,
*rHandle, length);
HUnlock(rHandle);
}
DisposHandle(rHandle);
}
else
result = MemError();
}
AEDisposeDesc(&theDesc);
}
return result;
}